package belpic.spring_data.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.jpa.domain.AbstractPersistable;

@Entity
public class User extends AbstractPersistable<Long>{

	private static final long serialVersionUID = 1L;

	@NotBlank
	@Column(unique = true)
	private String username;
	
	@Size(min=2, message="{belpic.spring_data.domain.User.firstname.message}")
	private String firstname;
	
	@Size(min=3, message="{belpic.spring_data.domain.User.lastname.message}")
	private String lastname;
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	
	@Override
	public String toString() {
		return username + " " + firstname + " " + lastname;
	}
}
